package cn.zf233.xcloud.intercept;

import cn.zf233.xcloud.util.ThreadSafeDateUtil;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by zf233 on 2020/11/4
 * 用于释放ThreadLocal
 * 存在无法执行释放动作的可能
 */
public class ThreadLocalIntercept implements HandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
        ThreadSafeDateUtil.remove();
    }
}
